2007-07-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkselection.c (normalize_to_crlf): Don't ignore
the passed-in len parameter. (#430049, Yevgen Muntyan)
svn path=/trunk/; revision=18423
+2007-07-09 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtkselection.c (normalize_to_crlf): Don't ignore
+ the passed-in len parameter. (#430049, Yevgen Muntyan)
+
2007-07-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkframe.c (gtk_frame_size_allocate): Improve the
{
GString *result = g_string_sized_new (len);
const gchar *p = str;
+ const gchar *end = str + len;
- while (1)
+ while (p < end)
{
if (*p == '\n')
g_string_append_c (result, '\r');
{
g_string_append_c (result, *p);
p++;
- if (*p != '\n')
+ if (p == end || *p != '\n')
g_string_append_c (result, '\n');
+ if (p == end)
+ break;
}
- if (*p == '\0')
- break;
-
g_string_append_c (result, *p);
p++;
}